import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-03-07
 * Time: 19:43
 */
public class test {
    public static int fib(int n) {
        if(n == 1) {
            return 0;
        } else if (n == 2) {
            return 1;
        } else {
            int f1 = 0;
            int f2 = 1;
            int f3 = 0;
            for (int i = 3; i <= n; i++) {
                f3 = f1 + f2;
                f1 = f2;
                f2 = f3;
            }
            return f3;
        }
    }
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int ret = fib(n);
        System.out.println(ret);
    }

    public static void main2(String[] args) {
        int[] arr = {1,2,3,4,5};
        for (int x:
             arr) {
            System.out.print(x+" ");//遍历arr取出每个元素放进x
        }
        System.out.println();
        for (int i = 0; i < arr.length; i++) {
            System.out.print(i + " ");
        }
        System.out.println();
        //将数组里面的值，以字符串的形式组织一下，然后进行打印
        System.out.println(Arrays.toString(arr));
    }

    public static void main3(String[] args) {
        int[] arr = new int[100];
        for (int i = 1; i <= 100; i++) {
            arr[i-1] = i;
        }
    }

    public static void printArray(int[] arr) {
        for (int x:
             arr) {
            System.out.print(x+" ");
        }
        System.out.println();
        for (int i = 0; i < 9; i++) {
            System.out.print(arr[i]+" ");
        }
        System.out.println();
        System.out.println(Arrays.toString(arr));
    }
    public static void main4(String[] args) {
        int[] arr = {1,2,3,4,5,6,7,8,9};
        printArray(arr);
    }

    public static void transform (int[] arr) {
        for (int i = 0; i < arr.length; i++) {
            arr[i] *= 2;
        }
    }
    public static void main5(String[] args) {
        int[] arr = {1,2,3,4,5};
        transform(arr);
        for (int x:
             arr) {
            System.out.print(x + " ");
        }

    }
    public static int sum(int[] arr) {
        int sum = 0;
        for (int j : arr) {
            sum += j;
        }
        return sum;
    }

    public static void main6(String[] args) {
        int[] arr = {1,2,3,4,5};
        int ret = sum(arr);
        System.out.println(ret);
    }
    public static double avg(int[] arr) {
        int sum = 0;
        for (int x:
             arr) {
            sum += x;
        }
        double ret = (double)sum / arr.length;
        return ret;
    }
    public static void func(int[] arr) {
        int[] arr2 = {1,5,6,7,8,9};
        arr = Arrays.copyOf(arr2, arr2.length);
    }
    public static int sum (int num) {
        if(num < 10) {
            return num;
        }
        return num % 10 + sum(num / 10);
    }
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5};
        int[] arr2 = new int[5];
//        func(arr);
        int sum = sum(111);
        System.out.println(sum);

//        System.arraycopy(arr, 1, arr2, 0, 4);
//        System.out.println(Arrays.toString(arr));
//        double ret = avg(arr);
//        System.out.println(ret);

    }
}
